Is there some modification to be done,to use get(x,y,width,height) function in Processing.js?
in
Processing with Other Languages
•
1 year ago
I have written the following code in Processgin IDE on my local machine and online on Processing.js editor at
http://sketch.processing.org/. However, the latter does not show anything. The motive of the code is to make an image to seem as poping-out out of a hole.
- Justin j1;
- int x1=0;
- void setup()
- {
- size(400, 300);
- println("starting app ..");
- j1=new Justin();
- }
- void draw()
- {
- background(100);
- j1.display((width/2)-30,height/2-x1);
- if(x1<60)
- x1++;
- }
- class Justin{
- PImage just,sec1;
- int ysize=0;
- Justin(){
- just=loadImage("https://lh4.googleusercontent.com/-b6Ux87YG_aM/T8HQfHzS1VI/AAAAAAAAAEQ/EeIIbcHrVx0/s128/justin%20bieber%20clipart.png");
- }
- void display(float x,float y){
- if(ysize<=just.height){
- image(just.get(0,0,just.width,ysize),x,y);
- ysize=ysize+1;
- }
- else
- image(just,x,y);
- }
- void setYSize(){
- ysize=0;
- }
- int getYSize(){
- return ysize;
- }
- }
1