{ "cells": [ { "cell_type": "code", "execution_count": 19, "metadata": { "collapsed": false }, "outputs": [ { "data": { "application/javascript": [ "\n", " var component = document.getElementById(\"sketch_18\");\n", " if (component != undefined)\n", " component.remove();\n", " component = document.getElementById(\"state_18\");\n", " if (component != undefined)\n", " component.remove();\n", " component = document.getElementById(\"controls_div_18\");\n", " if (component != undefined)\n", " component.remove();\n", " require([window.location.protocol + \"//calysto.github.io/javascripts/processing/processing.js\"], function() {\n", " // FIXME: Stop all previously running versions (?)\n", " var processingInstance = Processing.getInstanceById(\"canvas_18\");\n", " if (processingInstance != undefined && processingInstance.isRunning())\n", " processingInstance.noLoop();\n", " });\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "
\n", " Sketch #18:
\n", "
\n", "
\n", "
\n", " \n", " \n", " \n", " \n", "
\n", "Sketch #18 state: Loading...
\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "\n", "void setup() {\n", " size(500, 500); \n", "}\n", "\n", "void draw() {\n", " background(0, 0, 127);\n", " //drawSnowman(250, 250, 500 - mouseX, 500 - mouseY);\n", " drawSnowman(100, 100, 50, 75);\n", " drawSnowman(300, 200, 100, 100);\n", " drawSnowman(400, 50, 10, 10);\n", "}\n", "\n", "// define the function\n", "void drawSnowman(float x, float y, float w, float h) {\n", " noStroke();\n", " // body:\n", " ellipse(x, y, w, h);\n", " // head:\n", " float headHeight = h * .40;\n", " float headWidth = w * .40;\n", " float headY = y - h/3 - headHeight/2;\n", " ellipse(x, headY, headWidth, headHeight);\n", " // ears:\n", " float earWidth = headWidth * .30;\n", " float earHeight = headHeight * 2.0;\n", " ellipse(x - headWidth * .3, headY - earHeight/2, earWidth, earHeight);\n", " ellipse(x + headWidth * .3, headY - earHeight/2, earWidth, earHeight);\n", "}" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Calysto Processing", "language": "java", "name": "calysto_processing" }, "language_info": { "codemirror_mode": { "name": "text/x-java", "version": 2 }, "file_extension": ".java", "mimetype": "text/x-java", "name": "java" } }, "nbformat": 4, "nbformat_minor": 0 }