Finally @MegaSCamp - So sorry about the delay, but here are some more tips related to trail art!
Today we are covering: Curves, and some tips for simplifying your trail art code (as a bonus)
I use curves in pretty much all my Hopscotch trail art projects. Most of the objects in the real world are at least a little smooth in the edges. Today, I’m sharing my tips on how to do successful curves. Keep in mind that the trail art code that I am using for curves is simple, and there’s probably some faster way to do it. I have used this method for over a year now though, and I find it a great balance between speed and simplicity.
The basic idea is that to create a smooth turn (which is what a curve is), we draw a trail for a short distance, then turn a little bit, and repeat until we reach the target angle. I usually use this code, which is easily changeable:
repeat times(The angle you want the finished curve to have turned with / 10) draw a trail color(any color) width(any width) move forward(any move forward value, see below for tips) turn(10) degrees - see below for more info end repeat
If you read my concept explanation above, you probably realize what all these blocks do. I’ll just like to explain some of the values:
move forward - I usually put a value between 1-5, if I turn by 10 degrees every time. 1 is a super slight curve that is hardly noticeable if you have a width that’s bigger than 10-15. 5 is a pretty big curve - I’ve used it for iPhone trail art recreations in the past.
turn degrees - I have put 10 degrees as a static value in my example, because that is what I’m using the most. However, as long as you make sure to match this value with that the total curve angle is being divided with in the repeat times-bubble, you can put any value here. I usually put 5 or 9 if I’m not using 10 (9 because I can do Repeat Times 10 and get a 90-degree turn)
My curve has jagged edges! What should I do?
This problem happens to me every now and then, and it is because you move forward to much, and turn too little to compensate. Some solutions:
- Decrease the amount you turn with and divide the current move forward value with the same ratio that you decreased the turn block with (I usually divide both by two compared to what they were before when the line was jagged)
- Increase the trail width if you can (but this makes the lines thicker, so it may not be optimal)
- If the jagged edges are hardly noticeable, you can skip changing the code so you don’t have to compromise on the speed.
A tip when you’re reusing the same curve multiple times - put it in a rainbow custom block! That really helps to keep track of everything.
Need to see projects using my curve code? Open pretty much any of my trail art project, and look in all the rainbow blocks named “Curve” (they may have a number after them), and you’ll find lots of examples on how the same piece of code can fit in many different projects!
I’ll step up my game and get more of these tutorials out in a shorter period of time - but time really flies! Before we end this lesson though, I’ll like to share some quick tips on how to keep your code organized - something which I am technically good at, but when doing daily projects, I do choose quantity before organization. I’m sorry if any of you look at some of my projects and find the code and editor badly organized - you can always ask me if you have any questions. Nevermind, on to the tips!
Tips for keeping your code organized
Use custom blocks and rainbow rules as much as possible This really helps. If you are reusing the same piece of code over and over again, your best bet is to create a custom block for it. You often have to fine-tune trail art (I’ll probably provide my tips for that later on as well), and if you have to change a piece of code that you have reused with a custom block, you just have to do the changes one time to that custom block.
Even if you’re not reusing your code, you can always put it inside a custom block with a title that makes it easy for you to understand what part in the code that is related to each other, and what it does.
If possible, use clones or multiple objects It’s always cool to do fast trail arts. Therefore, you might want to execute code in parallel. If you haven’t worked with using clones to do things in parallel with your regular code, you can use multiple objects instead, or give the clone-method a go. It’s not actually that difficult - you create clones of the original object, and then put the trail art code that you’d normally would have put in a new object inside it’s one (If clone index = a unique number larger than 2 and smaller than the amount of clones that you have created +1) Use wait-blocks for adjusting the timing, and make sure to…
Name your objects Naming your objects really help to understand what they’re doing, as many trail art projects only include blank text objects.
Use the object view to scroll between objects To avoid editing and the wrong object and to increase development speed.
I hope you like these tips!
Next theme: not decided yet, reply if you have any suggestions!