mirror of
https://github.com/processing/processing4.git
synced 2026-01-29 11:21:06 +01:00
Cleaning examples for Beta launch
This commit is contained in:
@@ -25,19 +25,25 @@ void setup() {
|
||||
|
||||
void draw() {
|
||||
|
||||
int y1 = 0;
|
||||
int y2 = height/3;
|
||||
for (int i = 0; i < width; i++) {
|
||||
stroke(coswave[i]*255);
|
||||
line(i, 0, i, height/3);
|
||||
line(i, y1, i, y2);
|
||||
}
|
||||
|
||||
y1 = y2;
|
||||
y2 = y1 + y1;
|
||||
for (int i = 0; i < width; i++) {
|
||||
stroke(coswave[i]*255 / 4);
|
||||
line(i, height/3, i, height/3*2);
|
||||
line(i, y1, i, y2);
|
||||
}
|
||||
|
||||
|
||||
y1 = y2;
|
||||
y2 = height;
|
||||
for (int i = 0; i < width; i++) {
|
||||
stroke(255 - coswave[i]*255);
|
||||
line(i, height/3*2, i, height);
|
||||
line(i, y1, i, y2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,10 @@ void setup() {
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
// This embedded loop skips over values in the arrays based on
|
||||
// the spacer variable, so there are more values in the array
|
||||
// than are drawn here. Change the value of the spacer variable
|
||||
// to change the density of the points
|
||||
for (int y = 0; y < height; y += spacer) {
|
||||
for (int x = 0; x < width; x += spacer) {
|
||||
stroke(distances[x][y]);
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
* Array Objects.
|
||||
*
|
||||
* Demonstrates the syntax for creating an array of custom objects.
|
||||
*
|
||||
* Updated 26 February 2010.
|
||||
*/
|
||||
|
||||
int unit = 40;
|
||||
@@ -12,7 +10,6 @@ Module[] mods;
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
background(176);
|
||||
noStroke();
|
||||
int wideCount = width / unit;
|
||||
int highCount = height / unit;
|
||||
|
||||
@@ -22,6 +22,6 @@ void setup() {
|
||||
|
||||
void draw(){
|
||||
background(102);
|
||||
shape(bot, 110, 90, 100, 100); // Draw at coordinate (10, 10) at size 100 x 100
|
||||
shape(bot, 280, 40); // Draw at coordinate (70, 60) at the default size
|
||||
shape(bot, 110, 90, 100, 100); // Draw at coordinate (110, 90) at size 100 x 100
|
||||
shape(bot, 280, 40); // Draw at coordinate (280, 40) at the default size
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
/**
|
||||
* SVGPShape
|
||||
*
|
||||
* How to load an SVG into a PShape
|
||||
*/
|
||||
|
||||
// PShape object
|
||||
PShape svg;
|
||||
|
||||
void setup() {
|
||||
size(640, 360, P2D);
|
||||
smooth();
|
||||
// Load the SVG
|
||||
svg = loadShape("star.svg");
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(255);
|
||||
// Draw PShape at mouse location
|
||||
translate(mouseX, mouseY);
|
||||
shapeMode(CENTER);
|
||||
shape(svg);
|
||||
}
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://web.resource.org/cc/"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="293.89999"
|
||||
height="282.98001"
|
||||
id="svg2"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.45.1"
|
||||
version="1.0"
|
||||
sodipodi:docbase="/home/uwe/Desktop"
|
||||
sodipodi:docname="star.svg"
|
||||
inkscape:output_extension="org.inkscape.output.svg.inkscape">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="2"
|
||||
inkscape:cx="149.41261"
|
||||
inkscape:cy="100"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showguides="false"
|
||||
showgrid="true"
|
||||
height="282.98px"
|
||||
width="293.9px"
|
||||
inkscape:showpageshadow="true"
|
||||
borderlayer="false"
|
||||
showborder="true"
|
||||
inkscape:window-width="872"
|
||||
inkscape:window-height="624"
|
||||
inkscape:window-x="71"
|
||||
inkscape:window-y="47" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Ebene 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(-156.02455,-156.34725)">
|
||||
<path
|
||||
sodipodi:type="star"
|
||||
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:12.73799992;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path2160"
|
||||
sodipodi:sides="5"
|
||||
sodipodi:cx="197.14285"
|
||||
sodipodi:cy="155.21933"
|
||||
sodipodi:r1="50.377609"
|
||||
sodipodi:r2="132.57266"
|
||||
sodipodi:arg1="0.9229849"
|
||||
sodipodi:arg2="1.5513034"
|
||||
inkscape:flatsided="false"
|
||||
inkscape:rounded="3.1225023e-17"
|
||||
inkscape:randomized="0"
|
||||
d="M 227.54285,195.39076 L 199.72692,287.76681 L 168.33167,196.5451 L 71.881232,198.63634 L 148.93656,140.58863 L 117.14285,49.505045 L 196.16091,104.85129 L 272.96175,46.467294 L 244.74227,138.72087 L 324.00151,193.72116 L 227.54285,195.39076 z "
|
||||
transform="matrix(0.8199778,-0.5723954,0.5723954,0.8199778,53.582246,297.32687)" />
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.6 KiB |
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* Save Many Images.
|
||||
*
|
||||
* The saveFrame() function allows you to save images from
|
||||
* a program while it is running. This example saves the first
|
||||
* 50 frames of a program. These images can be imported into
|
||||
* animation software or QuickTime and then saved as a movie.
|
||||
*/
|
||||
|
||||
float x = 33;
|
||||
float numFrames = 50;
|
||||
|
||||
void setup()
|
||||
{
|
||||
size(200, 200);
|
||||
noStroke();
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
background(0);
|
||||
x += random(-2, 2);
|
||||
ellipse(x, 100, 80, 80);
|
||||
if (frameCount <= numFrames) {
|
||||
saveFrame("circles-####.tif");
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* by Daniel Shiffman.
|
||||
*
|
||||
* This example demonstrates how to use saveFrame() to render
|
||||
* our an image sequence that you can assemble into a movie
|
||||
* out an image sequence that you can assemble into a movie
|
||||
* using the MovieMaker tool.
|
||||
*/
|
||||
|
||||
@@ -50,8 +50,11 @@ void draw() {
|
||||
|
||||
// A red dot for when we are recording
|
||||
stroke(255);
|
||||
if (recording) fill(255, 0, 0);
|
||||
else noFill();
|
||||
if (recording) {
|
||||
fill(255, 0, 0);
|
||||
} else {
|
||||
noFill();
|
||||
}
|
||||
ellipse(width/2, height-48, 16, 16);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,14 +9,12 @@ int scaleValue = 3; // Multiplication factor
|
||||
int xoffset = 0; // x-axis offset
|
||||
int yoffset = 0; // y-axis offset
|
||||
|
||||
void setup()
|
||||
{
|
||||
void setup() {
|
||||
size(600, 600);
|
||||
stroke(0, 100);
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
void draw() {
|
||||
scale(scaleValue);
|
||||
translate(xoffset *(-width / scaleValue), yoffset *(-height / scaleValue));
|
||||
line(10, 150, 500, 50);
|
||||
@@ -24,9 +22,8 @@ void draw()
|
||||
setOffset();
|
||||
}
|
||||
|
||||
void setOffset()
|
||||
{
|
||||
save("lines-" + xoffset + "-" + yoffset + ".jpg");
|
||||
void setOffset() {
|
||||
save("lines-" + xoffset + "-" + yoffset + ".png");
|
||||
xoffset++;
|
||||
if (xoffset == scaleValue) {
|
||||
xoffset = 0;
|
||||
|
||||
@@ -7,19 +7,16 @@
|
||||
* same folder as the sketch's program file.
|
||||
*/
|
||||
|
||||
void setup()
|
||||
{
|
||||
void setup() {
|
||||
size(200, 200);
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
void draw() {
|
||||
background(204);
|
||||
line(0, 0, mouseX, height);
|
||||
line(width, 0, 0, mouseY);
|
||||
}
|
||||
|
||||
void mousePressed()
|
||||
{
|
||||
void mousePressed() {
|
||||
save("line.tif");
|
||||
}
|
||||
Reference in New Issue
Block a user