Monday, September 22, 2008

216 HEX COLOR ARRAY

hexArray = new Array("000000", "000033", "000066", "000099", "0000CC", "0000FF", "003300", "003333", "003366",
"003399", "0033CC", "0033FF", "006600", "006633", "006666", "006699", "0066CC", "0066FF", "009900", "009933",
"009966", "009999", "0099CC", "0099FF", "00CC00", "00CC33", "00CC66", "00CC99", "00CCCC", "00CCFF", "00FF00",
"00FF33", "00FF66", "00FF99", "00FFCC", "00FFFF", "330000", "330033", "330066", "330099", "3300CC", "3300FF",
"333300", "333333", "333366", "333399", "3333CC", "3333FF", "336600", "336633", "336666", "336699", "3366CC",
"3366FF", "339900", "339933", "339966", "339999", "3399CC", "3399FF", "33CC00", "33CC33", "33CC66", "33CC99",
"33CCCC", "33CCFF", "33FF00", "33FF33", "33FF66", "33FF99", "33FFCC", "33FFFF", "660000", "660033", "660066",
"660099", "6600CC", "6600FF", "663300", "663333", "663366", "663399", "6633CC", "6633FF", "666600", "666633",
"666666", "666699", "6666CC", "6666FF", "669900", "669933", "669966", "669999", "6699CC", "6699FF", "66CC00",
"66CC33", "66CC66", "66CC99", "66CCCC", "66CCFF", "66FF00", "66FF33", "66FF66", "66FF99", "66FFCC", "66FFFF",
"990000", "990033", "990066", "990099", "9900CC", "9900FF", "993300", "993333", "993366", "993399", "9933CC",
"9933FF", "996600", "996633", "996666", "996699", "9966CC", "9966FF", "999900", "999933", "999966", "999999",
"9999CC", "9999FF", "99CC00", "99CC33", "99CC66", "99CC99", "99CCCC", "99CCFF", "99FF00", "99FF33", "99FF66",
"99FF99", "99FFCC", "99FFFF", "CC0000", "CC0033", "CC0066", "CC0099", "CC00CC", "CC00FF", "CC3300", "CC3333",
"CC3366", "CC3399", "CC33CC", "CC33FF", "CC6600", "CC6633", "CC6666", "CC6699", "CC66CC", "CC66FF", "CC9900",
"CC9933", "CC9966", "CC9999", "CC99CC", "CC99FF", "CCCC00", "CCCC33", "CCCC66", "CCCC99", "CCCCCC", "CCCCFF",
"CCFF00", "CCFF33", "CCFF66", "CCFF99", "CCFFCC", "CCFFFF", "FF0000", "FF0033", "FF0066", "FF0099", "FF00CC",
"FF00FF", "FF3300", "FF3333", "FF3366", "FF3399", "FF33CC", "FF33FF", "FF6600", "FF6633", "FF6666", "FF6699",
"FF66CC", "FF66FF", "FF9900", "FF9933", "FF9966", "FF9999", "FF99CC", "FF99FF", "FFCC00", "FFCC33", "FFCC66",
"FFCC99", "FFCCCC", "FFCCFF", "FFFF00", "FFFF33", "FFFF66", "FFFF99", "FFFFCC", "FFFFFF");

Sunday, September 7, 2008

5 Awesome Javascript Effects -- WBP

For some reason I am having extreme internet complications. So I cant load any web pages, hurray! Nah Really though, I need to put a pass on the wifi asap!

Browsing around on the net I found some dope things!!!

http://blog.nihilogic.dk/

This dude here is a Javascript Master!
Hes doing things, that should be considered straight voodoo!

But check it out. Super Dope!




1. Image zooom!



URL: http://www.nihilogic.dk/labs/mojomagnify/

I tried this, its pretty complicated. Super advanced. It looks like allot of functions triggered with variables that are placed as methods in other functions. Its crazy!!!

2. Mario Cart (GOODNESS!)



http://blog.nihilogic.dk/2008/05/javascript-super-mario-kart.html


This is super dope. I have no idea or want to know how this is done!

3. 14k mario Bros...



http://blog.nihilogic.dk/2008/04/super-mario-in-14kb-javascript.html


I hate this guy!!!

4. HURRAY I FINALY FOUND AN AWESOME EXAMPLE OF A PARTICLE SYSTEM



http://www.nihilogic.dk/labs/particles/

Dope. this is awsome cause it has a user definalbe widget that lets you modify the particles. Awesome, I want to get more into particle systems with flash. This may be an awesome example of in Javaskript!


5. JQuery
Whoo, whats easier than using someone else's code. Using a library of some one else's code. WHOOOOOO
Instead of having to write all these fast fun easy javascript effects, you can reference jquery. And it will save your life. Whoooo

http://jquery.com/

Jquery is pretty cool actually. I use it as a reference tool, by looking at how something could be achieved, and is accomplished in jquery.
Since jquery depends on classes and id's of the html document. All the effects are visualy pleasing, and most of them you can control fairly simple.
Check check check...

Tuesday, August 19, 2008

Date Object! --- WBP

okay to start off, the date object is pretty cool to use. The only thing I don't like, is that it is only as in depth as numbers. If you want to define anything any other way, you need to build an array or two. Which don't get me wrong, this could be very useful, but is very tedious.

Lets get started.
1.Wed Sept 10 00:00:00 PDT 2007
This was easy, basically create a new date and alert it.
var myDate = new Date();
alert(myDate)

you will need the myDate variable to accomplish each question


2.9/15/2007
In order to do this, you need to use a couple methods from the date object.
I used
getMonth
getDate
and getFullYear


Create variables for each of these that distract the value from the entire date.
an ex.

var day = myDate.getDate()
var month = myDate.getMonth();
var year= myDate.getFullYear();

then alert those in a sequence.
document.write(month + "/" + day + "/" + year);

3.
February 10, 2007
This question is wak, basically you have to create an array to hold each month.
Then you want to use the index number to pull which month it is from the array.

var monthArray=new Array(12);
//Create an Array to hold all strings of months of year
monthArray[0]="January";
monthArray[1]="Febuary";
monthArray[2]="March";
.....
var m = myDate.getMonth();
document.write(monthArray[m] + " " + day + ", " + year);
To write the string properly you need to build the string using the same concept as the last question

4.
Output today’s date in this format: Monday, October 15, 2007
This concept is exactly the same. You need to build an array for the days of the week, and the month. The only trick is to use the getDay method to get the number of the day in the month, rather than the getDate the day of the week. :D
good Luck!

5.Output the time in this format: 11:30:03 AM

Heres another fun fun tedious ass time thing blah!
easy enough though this holds all the exact same concepts as the last ones. Except you use the
getHours
getMinutes
getSeconds methods
also, to be fancy I created a little conditional statement to display the AM or PM
I started out by finding out what that means.
Meridiem its latin! crazy
then i wrote a conditional statement that takes the hour of the day and sees if its before or after 12. noon.


//Define meridiem of day
var meridiem = String;
if(hour <= 11){
meridiem = " AM";
} else {
meridiem = " PM";
}


Then document. write your string. Easy as that

The other questions were over my head. :D
comments comments...

Monday, August 18, 2008

Midterm Intermediate -- Authoring

Alright, alright. I took a vacation, kill me.
Nah actually im coming to realize the term burnt out is really a verb not a suggestion. Im tired, basically too much work and school. Blah, im done, i finish. haha nah, lets get back to work.

So if you ready the reading for the Midterm in authoring, it explains that the requests are to be made using a Super Class. That combines all the little glamorous things that can be accomplished using the Draw Shape function from the Sprite class.

Well Lets get started, the assigment wants you to draw
1 green circle
1 grey square
1 blue square
and
1 red ellipse

Luckily since we will be accomplishing this all from one class, we dont have to hard code any of these shapes using the draw function. We can put that all into our class.

Lets start by creating a class called
DrawShape

with the hierchy placed in a com folder, in an ai folder. blah blah. yes we know that,
But do you know why we do that?

The reason you imbed your custom classes in deep rooted folders with the names of your company, is to insure your class. If people steal your code, there gonna have to work realy hard to get your company name out of the hierchy. Get it?

Next the class we created has to be a super class extending sprite!
This looks like
public class DrawShape extends Sprite{

Next we are going to create two custom classes, First lets build our circle function.
In our circle function we want to define some perameters

public function drawCircles(
name:String,
fillColor:uint,
strokeWeight:uint,
strokeColor:uint,
xPos:uint,
yPos:uint,
radius:uint)
:void{

Look at all those definitions! Basicaly I wrote out all that I want to be able to assign when building this shape. Next I need to associate my custom properties to variables within the sprite class. So with in my function I start with the fillColor
graphics.beginFill(fillColor)
This is done in the graphics class.
graphics.lineStyle(strokeWeight, strokeColor)
graphics.drawCircle(xPos, yPos, radius);
}

These are all defined in my Function
Looks like this!

public function drawCircles(name:String, fillColor:uint, strokeWeight:uint, strokeColor:uint, xPos:uint, yPos:uint, radius:uint):void{
graphics.beginFill(fillColor)
graphics.lineStyle(strokeWeight, strokeColor)
graphics.drawCircle(xPos, yPos, radius);
}


So now when you call up a drawCircles function you define all your properties!

I create a variable for greenCircle, it is of our DrawShape class and is a New DrawShape
private var greenCircle:DrawShape = new DrawShape;

So then we say what our greenCircle is:
greenCircle.drawCircles("greenCircle", 0x66CC33, 7, 0x336600, 50, 100, 50);
addChild(greenCircle);
//Notice it is in our drawCircles function within our DrawShape class!

See how it works!

See if you can get it to work and draw your other shapes!
The same process is used in the drawRectangle and drawElipse function within our DrawShape class!

NEXT....
I add some listeners to my new shapes!
greenCircle.addEventListener(MouseEvent.CLICK, greenCircleRemover);
redEllipse.addEventListener(MouseEvent.CLICK, greyRecRemove);
blueRectangle.addEventListener(MouseEvent.CLICK, addGreenCirc);
miniGreenCircle.addEventListener(MouseEvent.CLICK, moveUp);

First function:
function greenCircleRemover(e:Event):void{
removeChild(greenCircle);
}
This will remove the child of
greenCircle var!
Get it?

The next one is exactly the same! but you remove the grey rectangle!

Now we say if you cclick our blue rectangle we want to add 10 green circles!

well within our blueRect function we need a for loop that runs 10 times.
Within that loop we want to build a green circle every time it loops.
Lets create the first green circle in a var!
Then we can define what our miniGreenCircle variables is!
miniGreenCircle.drawCircles("miniGreenCircle", 0x66CC33, 2, 0x336600, i * 25, 275, 10);
Then we want to addChild.

Bling that it!

We also want to move those up 10 pixels when they are clicked. Since they are all the instance of
miniGreenCircle, all we need is one function to control that variable!

Then we -= 10 to the y position!
Get that?

Let me know if you got it! COMMENT!
:D



This should add the 10 green circles

Wednesday, August 6, 2008

= == === ??? (WBP Notes)

=
Assigns values

"red" = 2;
"blue" = 1;

alert(1);
//we get red
alert(2);
//we get blue

==
is used to compare values in a condition
does this equal this!

if (1 == "red"){
alert("This is true, we assigned 1 to red");
}

===
is used to make sure that this is exactly true, no ifs and or buts. This better be true!
Checks the input and datatype!
so no matter what 1 has to be 1.
if (1 === 1){
}

}

Saturday, August 2, 2008

DRAFT -- Week 03 HW3 -- WBP *** Ekstra Kredit

Alright. This is a tough one.
We want to ask the user for an input. Then we want to print out every prime number that comes before the userInp.

Hmmm

A prime number is anything that can only be divided by its self, and one.
That means that it can not be cut in half, basicaly.
Which also means, that if it has a Modulo its remainder would be 0. Right?

%2
hmmm.

First. I need to get this userInp.
PROMPT

var userInp = prompt("Yo, Diggidy, Give me a number", "");
Lets parse
var userNum = parseInt(userInp);

Now lets see if our userNum was cut in half, would it cut evenly?

if (userNum % 2 == 0){
prompt("Sorry, this is NOT a prime number!");

} else {
prompt("Yo this IS a prime number!");
}

:D
We know what numbers are. How do we print them out!

*** Pseudo Coding ***
If my number is a prime number, I need to take every other prime number that is less of it, and print it.
So that means, every number that has a % 2 == 0
I want to print.

So someway I need to say that any number that is before userNum, needs to see if it is dividable by two. If it is, print.
!!Also, I need to Loop through each number to see if its modulo is 0.

For loop.
I need to make sure that my 4 loop goes as many times as my User num, so I can get each number before it.

for (aNum = 1;
aNum < userNum; aNum++ ){
}

What do we want to happen.
we want to check the Modulo thing. Well, we already did that in our If Statement.
Lets LOOK! inside our loop and see what happens.
The first line...

if(userNum % 2 ==0){
!!Dont do anything
} else {
//We now want to print!
EVERY NUMBER THAT
Cannt be divided by two and equal zero!

}

if (userNum % 2 == 0){
prompt("Sorry, this is NOT a prime number!");
} else {
prompt("Yo this
IS a prime number!");



Break Time!!!!
I need to think about this a little more!!!

var userInp = prompt("Enter a number.");
var userNum = parseInt(userInp)
for (var aNum = 0; aNum <>
//document.write("blahblah");
if (userNum % 2 == 0){
//document.write(userNum);
alert("Sorry, this is not a correct Prime Number.");
break;
} else if (userNum % 2 != 0){
document.write(aNum + " Is a prime number." + "
");


}
}







Friday, August 1, 2008

Week 03 HW2 -- WBP

Homework assignment two was much easier than than the first one.
The assigment is two create a javascript Guessing number game.

First you need to start out by creating a random number 1-10.
I still am confused how to create a random number 1-10, but I found some documentation on W3Schools that writes like this

var rndNum = (Math.ceil(Math.random()*10));

This will create a random number 1-10 each time.
I suggest you alert your random number to test your guessing game.

You need to give the user 3 tries to guess the random number, and if they do not guess it correct they fail. But if they guess correctly they win!

I started out by creating a for loop that will occur 3 times.
This is simple by saying that 1 < 3 so keep going

for (i = 1; i <= 3; i++){

This will loop 3 times.
Next you need to get the users input and parse it into a number, like in the last assignment.

var userInp = prompt("Please Guess a Number from 1 - 10", "")
var userNum = parseInt(userInp);
//Notice im parsing variable userInp!

You can basically I copied that from HW1

Now we need to check if the UserNum is equal to our random number

Since our random number is in a variable called rndNum we can create a simple if statement that checks to see if userNum is == to rndNum

If (userInp == rndNum) {
then we go ahead and alert, "Hurray you got the correct number.

}
if else (userInp != rndNum){
then we need to say."You didnt guess the correct number"
}


I ran into a tricky position. I kept repeating the for loop 3 times regardless if they one or loss.

I figured out that if they won, I needed to break the for loop.
I did this by using
break;

The only question is...
Where did I put it?

Also, heres something else I added to my Guessing game.
If you get the message "You didn't guess the correct number"
3 Times, you will get a prompt saying that you have "Lost the Game"
How do you think this was done.

a Hint, it involves an if about my variable i


:D


-Franky