Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Alpha Mask.
- *
- * Loads a "mask" for an image to specify the transparency
- * in different parts of the image. The two images are blended
- * together using the mask() method of PImage.
- */
- float coeficient = 0;
- float exponent = 0;
- import controlP5.*;
- String textValue = "";
- ControlP5 cp5;
- void setup() {
- size(640, 360);
- cp5 = new ControlP5(this);
- PFont font = createFont("arial",20);
- cp5.addTextfield("exponent")
- .setPosition(20,100)
- .setSize(200,40)
- .setFont(font)
- .setFocus(true)
- .setColor(color(255,0,0))
- ;
- cp5.addTextfield("coeficient")
- .setPosition(20,200)
- .setSize(200,40)
- .setFont(font)
- .setFocus(true)
- .setColor(color(255,0,0))
- ;
- }
- void draw() {
- background(0, 102, 153);
- coeficient = float(cp5.get(Textfield.class,"coeficient").getText());
- exponent = float(cp5.get(Textfield.class,"exponent").getText());
- float secondCoeficient = coeficient*exponent;
- float secondExponent = exponent-1;
- text(secondCoeficient+"x^"+secondExponent,320,180);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement