Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7007703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:38:29+00:00 2026-05-27T21:38:29+00:00

The amazing Illustrator plugin Ai->canvas exports arbitrary complex Illustrator images to Javascript code that

  • 0

The amazing Illustrator plugin Ai->canvas exports arbitrary complex Illustrator images to Javascript code that draws on <canvas>. For example, this is the code for a green square 150×150

function draw(ctx) {

  // layer4/Path
  ctx.save();
  ctx.beginPath();
  ctx.moveTo(150.0, 150.0);
  ctx.lineTo(0.0, 150.0);
  ctx.lineTo(0.0, 0.0);
  ctx.lineTo(150.0, 0.0);
  ctx.lineTo(150.0, 150.0);
  ctx.closePath();
  ctx.fillStyle = "rgb(0, 255, 0)";
  ctx.fill();
  ctx.restore();
}

This is a stupid example because drawing a square is better done with a rectangle, but anyway, for complex images, this is invaluable. The problem is scaling.

How can I transform a generic draw function output by Ai->canvas in order to accept a scale factor? This square example is pretty straight forward, but I’d like something more generic to be applied to a Javascript function drawing on canvas (with arcs, circles, bezier curves…). Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:38:30+00:00Added an answer on May 27, 2026 at 9:38 pm

    One option is to use the scale function of the canvas, e.g.:

    ctx.scale(xFactor, yFactor);
    

    More here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use this amazing plugin: http://code.drewwilson.com/entry/autosuggest-jquery-plugin The problem I'm having is that
I found this amazing resource http://gtmetrix.com/ that you supply a URL to a website
Prescript: The amazing etherpad was recently open sourced. Get it here: http://code.google.com/p/etherpad . This
I have found this amazing control that does exactly what I need, only problem,
I'm making a form that I'm using the amazing JQuery validation plugin for (
I found this amazing code to make a dropdownlist with check boxes: Click here
I talked to a few friends who say that Drupal is amazing, and it
I have looked at this page for some time now. Amazing, really. But I
This is an amazing effect like PPT. Link is here : http://udc.weibo.com/builder2011/data.html I know
It is amazing.Each combobox cell has specific items(I couldn't show in the picture). http://up.vatandownload.com/images/f6sq44ycqe34ptw37m42.jpg

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.