Git Product home page Git Product logo

Comments (5)

typemytype avatar typemytype commented on July 3, 2024

Hi Thom

see http://www.drawbot.com/content/canvas/pages.html#size http://www.drawbot.com/content/canvas/pages.html#size

It is advised to use size() always at the top of the script

gr Frederik
www.typemytype.com

On 25 Apr 2015, at 21:35, Thom Janssen [email protected] wrote:

I tried to crop my canvas but it seems this is not the way?

example:

rect(100,200,300,400)
translate(100,200)
size(300,400)
The result is cropped from the original origin. Not the one set in line 2.

I know there is an advice to use size() on the top of the script, but I what if you don't know where something will be drawn?
I have some scripts where (randomly) things are drawn. The script keeps track of the minimum-x, minimum-y, max-x and max-y. Later I want to crop the canvas and/or expand it, to fit it all nicely...

Any ideas?

Thanks, Thom

β€”
Reply to this email directly or view it on GitHub #15.

from drawbot.

thomgb avatar thomgb commented on July 3, 2024

Hi Frederik,

Thanks. I know about the advice.
There is -for now- no way to crop the canvas, after some drawing is done?

Thom

from drawbot.

justvanrossum avatar justvanrossum commented on July 3, 2024

Calculate your positions first, then do the appropriate size() and translate(), then do your drawing.

from drawbot.

justvanrossum avatar justvanrossum commented on July 3, 2024

Closing this issue: there's no way size() can honor the current transformation. Imagine a skew or rotation...

from drawbot.

thomgb avatar thomgb commented on July 3, 2024

Thanks Just.
Your suggestion is already my current set up :)

from drawbot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.