This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| main(); | |
| function main() { | |
| var myIdleTask = app.idleTasks.add({ | |
| name: “my_idle_task”, | |
| sleep: 1000 | |
| }); | |
| var onIdleEventListener = myIdleTask.addEventListener(IdleEvent.ON_IDLE, onIdleEventHandler, false); | |
| } | |
| // SETINTERVAL DOSNT EXIST SO WE USE THE ONLY POSSIBLE WAY ONIDLE EVENT: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Points mover; | |
| int docWidth, docHeight; | |
| int dpi = 300; //TODO! | |
| float scaleFactor = 1; | |
| int arrayLength = 300; | |
| float minDistance, maxDistance, lineWeightMin, lineWeightMax, circleSizeMin, circleSizeMax; | |
| Points[] myArray = new Points[(arrayLength + 3)]; | |
| PGraphics imageHolder; | |
| void setup() { | |
| docWidth = 1300; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String[] sa1 = { "OH ", "NY ", "CA "}; | |
| println(sa1); // --> OH, NY, CA | |
| println(sa1.length); // --> 3 | |
| sa1 = shorten(sa1); | |
| println(sa1); // --> OH, NY | |
| println(sa1.length); // --> 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int pointsNumber = 300; | |
| Points[] pointsArray = new Points[pointsNumber]; | |
| class Points { | |
| PVector location; | |
| float circleSize; | |
| float gravity; | |
| float lineWeight; | |
| color strokeColor; | |
| int docHeight = height; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class HashGrid { | |
| float bucketSize; | |
| int gridWidth, gridHeight, bucketLength, numberOfRows, numberOfCols; | |
| Buckets[] buckets; | |
| HashGrid(float bucketSize_, int gridWidth_, int gridHeight_, int bucketLength_) { | |
| bucketSize = bucketSize_; | |
| gridWidth = gridWidth_; | |
| gridHeight = gridHeight_; | |
| bucketLength = bucketLength_; // bucketLength = ceil(10 * (numOfElements / ((gridWidth * gridHeight)/ bucketSize))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class HashGrid { | |
| float bucketSize; | |
| int gridWidth, gridHeight, bucketLength, numberOfRows, numberOfCols; | |
| HashGrid(float bucketSize_, int gridWidth_, int gridHeight_, int bucketLength_) { | |
| } | |
| void set(Points point_) { //TODO: it is better probably to use an interface instead of hardcoding it but for now! ... | |
| } | |
| Points[] get(PVector location_) { | |
| Points[] answer = new Points[answerLength]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| HashGrid test; | |
| float scaleFactor = 1; | |
| void setup(){ | |
| size(500, 500); | |
| test = new HashGrid(50, width, height, 30); | |
| test.drawGrid(); | |
| for(int i = 0; i < pointsNumber; i++){ | |
| pointsArray[i] = new Points(); | |
| test.set(pointsArray[i]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // http://armand.eu/blog/working-with-measurement-units-in-adobe-extendscript/ | |
| function changeUnitsToPixels(){ | |
| if(typeof originalUnitsH === 'undefined') originalUnitsH = app.documents[0].viewPreferences.horizontalMeasurementUnits; | |
| if(typeof originalUnitsV === 'undefined') originalUnitsV = app.documents[0].viewPreferences.verticalMeasurementUnits; | |
| app.documents[0].viewPreferences.horizontalMeasurementUnits = app.documents[0].viewPreferences.verticalMeasurementUnits = MeasurementUnits.pixels; | |
| } | |
| function changeUnitsBack(){ | |
| app.documents[0].viewPreferences.horizontalMeasurementUnits = originalUnitsH; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var myPath = app.activeDocument.filePath; | |
| alert(myPath); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var myPath = (app.activeDocument.fullName.parent.fsName).toString().replace(/\\/g, '/'); | |
| alert(myPath); |
OlderNewer