Advertisement
Guest User

Untitled

a guest
Oct 21st, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. /**
  2. * Alpha Mask.
  3. *
  4. * Loads a "mask" for an image to specify the transparency
  5. * in different parts of the image. The two images are blended
  6. * together using the mask() method of PImage.
  7. */
  8.  
  9. float coeficient = 0;
  10. float exponent = 0;
  11. import controlP5.*;
  12. String textValue = "";
  13. ControlP5 cp5;
  14. void setup() {
  15. size(640, 360);
  16. cp5 = new ControlP5(this);
  17.  
  18. PFont font = createFont("arial",20);
  19. cp5.addTextfield("exponent")
  20. .setPosition(20,100)
  21. .setSize(200,40)
  22. .setFont(font)
  23. .setFocus(true)
  24. .setColor(color(255,0,0))
  25. ;
  26. cp5.addTextfield("coeficient")
  27. .setPosition(20,200)
  28. .setSize(200,40)
  29. .setFont(font)
  30. .setFocus(true)
  31. .setColor(color(255,0,0))
  32. ;
  33.  
  34. }
  35.  
  36. void draw() {
  37. background(0, 102, 153);
  38. coeficient = float(cp5.get(Textfield.class,"coeficient").getText());
  39. exponent = float(cp5.get(Textfield.class,"exponent").getText());
  40. float secondCoeficient = coeficient*exponent;
  41. float secondExponent = exponent-1;
  42. text(secondCoeficient+"x^"+secondExponent,320,180);
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement