Advertisement
JoshuaDavis

nesting and HOscillator

Jan 31st, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. // r2 nested in r1, HOscillator on r1 ALSO oscillates the nested r2
  2.  
  3. HRect r1, r2;
  4.  
  5. void setup(){
  6.     size(640,640);
  7.     H.init(this).background(#202020);
  8.     smooth();
  9.  
  10.     r1 = new HRect(100).rounding(10);
  11.     H.add(r1)
  12.         .anchorAt(H.CENTER)
  13.         .loc(width/2,height/2)
  14.         .noStroke()
  15.         .fill(#FF3300)
  16.     ;
  17.  
  18.     r2 = new HRect(50).rounding(5);
  19.     r1.add(r2)
  20.         .anchorAt(H.CENTER)
  21.         .noStroke()
  22.         .fill(#0095a8)
  23.     ;
  24.  
  25.     new HOscillator().target(r1).property(H.ROTATION).range(-180, 180).speed(0.5).freq(5);
  26. }
  27.  
  28. void draw(){
  29.     H.drawStage();
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement