Timeline for What is that angle?
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 17, 2020 at 9:04 | history | edited | CommunityBot |
Commonmark migration
|
|
Nov 28, 2015 at 14:57 | comment | added | Ismael Miguel | @insertusernamehere Yeah, you can ignore the byte count. But you have to specify that it is an anonymous function | |
Nov 28, 2015 at 9:59 | comment | added | insertusernamehere |
@IsmaelMiguel Thanks for your detailed feedback. You're right about the canvas. In the beginning I tried to rotate and mirror the image, so that the angle doesn't need to be transformed. You can say good-bye to that! Got blurry, couldn't find the right pixel. I've skipped the onload part as I was undercut in another challenge because of that. So I thought it's ok to assume that it loads fast enough. Regarding the anonymous function I'm not sure how to count it. If I cut off f= and I want to invoke it I have to wrap it in () like (s=>{})('arg'); . Can I ignore this in byte count?
|
|
Nov 28, 2015 at 9:42 | history | edited | insertusernamehere | CC BY-SA 3.0 |
added 10 characters in body
|
Nov 27, 2015 at 18:17 | comment | added | Ismael Miguel |
This code works because you are lucky. The canvas will be tainted almost everytime. Specially with file:// . You need to set the crossOrigin property. Also, it won't work if the image loading takes 0.00001 seconds more than creating the canvas does. Also, you don't need the f= , cutting off 2 bytes. But it is a nice solution indeed!!! My upvote for it.
|
|
Nov 27, 2015 at 9:55 | history | edited | insertusernamehere | CC BY-SA 3.0 |
added 56 characters in body
|
Nov 27, 2015 at 9:46 | history | edited | insertusernamehere | CC BY-SA 3.0 |
deleted 2 characters in body
|
Nov 27, 2015 at 0:56 | comment | added | user81655 |
I think this should work (haven't tested it). 206 bytes: s=>{(i=new Image).src=s;with(Math)with(document.createElement`canvas`.getContext`2d`)for(drawImage(i,0,0,100,100),a=360;r=--a/180*PI;)getImageData(50+48*cos(r),50+48*sin(r),1,1).data[1]||alert((450-a)%360)}
|
|
Nov 27, 2015 at 0:34 | history | edited | insertusernamehere | CC BY-SA 3.0 |
added 107 characters in body
|
Nov 26, 2015 at 23:25 | history | edited | insertusernamehere | CC BY-SA 3.0 |
added 2 characters in body
|
Nov 26, 2015 at 23:18 | history | answered | insertusernamehere | CC BY-SA 3.0 |