ICM_ToxiclibsTest_Mushroom

First attempt to use amazing library Toxiclibs, mushroom-like water creatures with big head and jumpy acts. Cursor is an attractor to pull them closer to each other. And it ends up with a beautiful mistake oops.

As you can see, the frame rate of it became super slow because I put addBehavior() in draw() instead of in setup(), or in the constructor of the class. If I didn’t have an office hour with Daniel Shiffman I’d never know! But after I rewrote my codes, having all of the adding-force stuff happen just once, my sketch became less interesting, as below.

 

Less violent and less organic : Still trying to figure out how to solve the problem –> Making the violent/organic/electric movement without dragging down the whole system.

Here’re the codes: v.1, v.2.

CookieSpider

HW_5_cookie

Choco spider cookie– lovely product that makes you scream on the second of you opening your mouth to give it a bite! Things is that, I felt extremely hungry recently and just couldn’t help eat up all the food around me, and if this cookie existed it would do me a huge favor.

For this assignment, I practiced the usage of ArrayList and PImage, and was more comfortable with PVector. And I’ve also learned about the function lerp() and velocity.heading() of PVector through the office hour with Daniel Shiffman! Below are some bloody difficulties I came across.

  1. Button functions!!! Arrhhhhh…. Use a lot of boolean to differentiate the mouse functions, e.g mousePressed() mouseDragged(), and mouseReleased(). Try and error…
  2. lerp() <– super useful!!
    • lerp(start, stop, amt) <– The amt parameter is the amount to interpolate between the two values where 0.0 equal to the first point, 0.1 is very near the first point, 0.5 is half-way in between, etc.
  3. Don’t know how to make object of ArrayList interact with its fellows until the office hour w/ Dan. Just write two “for loop”s! One for itself, one for the others.
  4. In order to create the effect of animation, I tried using frameCount and it worked!
    • void grow() {
          if (frameCount % 14 == 1 && j<4) {
            legs.add(new Leg(0, 0, 20*cos(angle), 20*sin(angle)));
            angle += PI/6;
            j++;
          }
      
          if (j==4) {
            angle += PI/3;
            j++;
          }
      
          if (j>4) {
            if (frameCount % 14 == 1 && j<9) {
              legs.add(new Leg(0, 0, 20*cos(angle), 20*sin(angle)));
              angle += PI/6;
              j++;
            }
          }
        }
  5. Within PVector, you can use velocity.heading() to rotate object with its moving direction(check out Nature of Code!!!). That’s how I rotated my spiders and their traces. Combined with lerp(), my spider makes its slow U-turn in the beginning of birth.

But honestly, this time I was not thrilled about my work. Especially after I connected it whit Arduino. It worked, but I just didn’t feel it interesting enough. It’s really difficult to be creative, especially when you want to be. Maybe that’s because I was hungry that time….? It’s like you make a lot of efforts to give birth a baby, but in the end you find you don’t love he/she at all    :/

Anyway, below are the codes.

Continue reading

ICM_4_PatchBallsFlies

Here’s the combination of what I’ve learned so far from Learning Processing and The Nature of Code. I call it “Patch. Balls. and Flies”. It’s kind of messy but I’m glad all the interactions with each others work! Yah! Check it out(click click )!

Functions:
1) move patch to stop bouncing balls
2) press mouse to drag balls with patch
3) long-press keyboard to see flies clubbing!! B-)   (surprisingly fit this perfectly, the most EXCITING part, DANCING time!!)
4) let go keyboard(== keyReleased) to calm down the flies, and gather all the balls within the patch

(Forgive me the awful screen pics, can’t screenshot since this one involve functions of KEY.)

bouncing

clubbing_flies

reset

Here’s some struggles I’ve been through:

  1. when dragging balls, I calculated the distance with patch and ball, and then planed to add this fixed distance to the position of patch and set it as the position of balls. But since I wrote this code in void mouseDragged(), I recalculated the distance every time I dragged and that caused flickering. Thanks to the office hour w/ Daniel Shiffman, this calculation codes were moved into void mousePressed() and it worked!!! (tearing)
  2. same stupid things happened when I want to bump flies with balls: I forgot to set conditions and thus make flies be affected by every balls!
  3. Things getting complicated when I want to make the music band. In the end I successfully saved the original color, and changed the color once it’s been hit(hitGround == true &&  cubes.x < ball.x <cubes.x+w  && ball.y < (height-h)), and then restored the colors back later.

And codes time!

Continue reading

ICM_3_RainMan & Triangles

Time flies and here I am sweet ICM homework #3. It’s a collaboration work by Karam and I, and basically we just used each other’s class and try to make some interaction! I got the triangle class from Karam and background idea from Gladys, and this work was inspired by reading The Nature of Code of Daniel Shiffman. Just finished chapter 1. Super good/tough stuff!!

   

Here’s my new born baby(click me click me)! It’s about a person who loves being rained, just enjoys the feeling of being miserable. When rain stops, the smile stops and background went blue. You can click your mouse and make this guy happy again.

For this, I wrote 5 classes… just couldn’t stop, and hit into wall sooo many time. I was like a small rooted tree in the corner of ITP floor on Monday. And here’s are some problems(all about using class in class) and answers(except the last one) from try-and-error process of myself.

  • Where to put the moving code?
    • make sure you can control the position in the { } in which the leading moving codes(e.g. x++) settle
  • If things moves in different way?
    • put moving codes separately in its own class
  • Wants rains start from cloud
    • don’t need to declare Cloud class in Rain class!! can use it directly(tearing)
  • How to make smile affected by rain????

Still can’t solve the last problem. I guess there must be something wrong about my rain drops. I use distance between each rain drop and the man’s head to write some condition codes. The rain drops may seem to be affected well by the man, but I bet it’s actually not what we think they are, and that’s why although I could affect rain drops with the man, I failed to affect the smile with the rain drops? Too complicated. So in the end, I compromised and made the man smile when it’s raining and sad when it’s not.

Maybe it’s time to book an office hour with Dan.

And as usual, below are my baby’s bloody organs(codes).

Continue reading

ICM_02_CloudPaint

This is the idea of Caitlin and I, a self-made Paint software, for ICM week_02’s homework, making something animated and designed an UI. At first, we were ambitious and made a ideal Paint with multiple function, and even a fancy UI. BUT, it’s just too hard to accomplish 😉  Process of bloody stumbling is as followed:

  1. made 3 floating cubes to choose colors from.
  2. frustrated to find out that the color of every cube’s rim changed when I choose different stroke color.
  3. same thing happened in stroke width.
  4. P A N I C .
  5. Struggling for hours.
  6. thought object-orientation program might be the answer of this puzzle, so started learning OOP from scratch.
  7. excited to have a workable class of drifting clouds.
  8. frustrated to find out that problem still existed.
  9. P A N I C .
  10. Struggling for hours.
  11. so desperate that I started googling my problem.
  12. found out the existence of pushStyle()/popStyle()!
  13. had a bitter(FXCK!)-yet-sweet(YAH!) moment for a while.
  14. added stroke width, eraser, and new paper function to finish my mini-Paint.
  15. L E A R N E D    A    L O T .

And here’s my bloody baby!(click me click me click me)

And below are my bloody baby’s organs(codes).

Continue reading