Animating text with jQuery for creative writing

Please check out this fiddle,

My attempt was to design an animation where a div glides in, followed by text appearing character by character.

I am aiming for a smoother writing effect rather than the current typing effect I have achieved.

Does anyone know of a jquery plugin that can accomplish this? Or is there a way to improve my code in order to achieve the desired outcome?

Answer №1

If you're up for the challenge, one way to achieve this is by utilizing svg animations with the help of the raphael javascript library. Below is a snippet of code that has been slightly modified from the raphael animation demo, serving as a proof of concept. Keep in mind that you may need to incorporate multiple gradual path animations to achieve your desired effect.

<html>
    <head>
        <meta charset="utf-8">
        <title>Raphaël · Animation</title>
        <link rel="stylesheet" href="http://raphaeljs.com/demo.css"media="screen">
        <link rel="stylesheet" href="http://raphaeljs.com/demo-print.css"media="print">
        <style media="screen">
            #holder {
                height: 419px;
                margin: -205px 0 0 -305px;
                width: 619px;
            }
        </style>
        <script src="http://raphaeljs.com/raphael.js"></script>

        <script>
            Raphael.fn.arrow = function (x, y) {
                return this.path(["M", x, y] + "m-10-10l20,0 0-6 10,16 -10,16 0-6 -20,0 0,6 -10-16 10-16z").attr({fill: "#fff", stroke: "none", "stroke-dasharray": "-", "fill-opacity": 0.2});
            };
            window.onload = function () {
                var r = Raphael("holder", 619, 419),
                    dashed = {fill: "none", stroke: "#666", "stroke-dasharray": "- "};
                // Path 3
                (function () {
                    var el = r.path("M20,290c0-20 40,20 40,0").attr({fill: "none", stroke: "#fff", "stroke-width": 2}),
                        elattrs = [{path: "M20,290c0-20 40,20 40,0c0-20 -40,20 -40,0z"}, {path: "M20,290c0-20 40,20 40,0c"}],
                        now = 1;
                    r.arrow(90, 290).node.onclick = function () {
                        el.stop().animate(elattrs[+(now = !now)], 1000);
                    };
                })();
            };
        </script>
    </head>
    <body>
        <div id="holder"></div>
    </body>
</html>

Answer №2

Starting in 2013, the new Creative Vector Studio launched a jQuery Plugin designed to generate SVG animations named Lazy Line Painter. This groundbreaking tool is based on Raphaël technology.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Modifying the color of a placeholder in an HTML input using CSS

Version 4 of Chrome now supports the placeholder attribute on input[type=text] elements (and likely other browsers do too). Despite this, the following CSS code does not affect the color of the placeholder text: input[placeholder], [placeholder], *[pla ...

When rails code is placed within haml tags, it results in generating empty spaces within the HTML tags of browsers

Every time a rails variable is nil (or when using rails code (as seen in the third code example)), my html displays a string of empty characters. new.html.haml %h1.editable.editable_title_field{:contenteditable => 'true', :placeholder => ...

Insert HTML code that is activated when the selection is modified

I have a simple dropdown menu in my HTML code. HTML <select name="breed" onchange="breedChanged()"> <?php while ($row = gdrcd_query($result, 'fetch')){ ?> <option value="<?php echo $row['id_breed']; ?& ...

What is the correct way to adjust the style.top attribute of an element using JavaScript?

In order to correct a JavaScript source code, I need to adjust the style.top property of a div element based on an integer parameter from a function called index. Here is the current implementation: div.style.top = (index * 22 + 2)+"px"; However, for lar ...

PHP - Extract Information from Table Upon Form Submission without User Input

I'm facing a challenge with my web form that includes a table allowing users to delete rows before submitting. Although there are no input fields in the table, I need to capture the data from these rows when the form is submitted. The issue is that th ...

Having issues with closing a div tag using $.after() function

This issue can be better understood with an example: http://jsbin.com/lavonexuse The challenge here is to insert a full-width row after a specific column (identified by the class .insertion-point) when "Insert Row" is clicked. The problem I'm facing ...

What is the maximum number of JavaScript functions allowed in a single HTML file?

My HTML5 file includes JavaScript (created from CoffeeScript) directly within the HTML file, as I prefer this approach for my HTML/JavaScript programming. The code consists of four JavaScript functions that convert one temperature unit to another. Strang ...

Enabling and disabling multiple input fields based on the status of a checkbox in order to manage dynamic inputs

I need help with a situation involving dynamic input fields and checkboxes. My goal is to disable the input field if the checkbox with the corresponding ID is checked. Here is the PHP code snippet: <table class="table table-striped"> <thead& ...

Validation of forms using Javascript

I currently have an HTML form with JavaScript validation. Instead of displaying error messages in a popup using the alert command, how can I show them next to the text boxes? Here is my current code: if (document.gfiDownloadForm.txtFirstName.value == &ap ...

When a user taps on a link or anchor within a specific webpage on an iPhone, the font size will automatically increase

The issue is specific to iPhones. I have tested it on an iPhone 5 (landscape mode) and an iPhone 4s (landscape mode). For a visual demonstration, you can view the video here. I attempted to fix the problem by specifying the font size, but unfortunately, ...

Issue with unordered list item styling in CSS

Encountered a peculiar problem: Within my .cshtml file, there is another element: <ul> <li>Test</li> <li>Test2 <ul> <li>Test3</li> </ul> </li> <li>Tes ...

Looking to conceal an <hr> element using jQuery's slideToggle function and then reveal it when clicked once more

I recently embarked on my journey to learn jQuery. I encountered a challenge with a simple button that triggers the slideToggle function to show/hide a div. Directly above this toggled div, there is an break line which I want to hide when the button is in ...

How can I update a date value received from a v-model in Vue.js when the input type is set to "date"?

My issue lies in the date format coming as "9999-99-99 00:00:00", while I want it to be just "9999-99-99". The dates are stored in an array with multiple fields. How can I update the value using Vue.js? new Vue({ el: '#app', data: () => ...

What is the best way to prevent the dropdown function in a selectpicker (Bootstrap-Select)?

Is there a way to completely disable a selectpicker when a radio button is set to "No"? The current code I have only partially disables the selectpicker: $("#mySelect").prop("disabled", true); $(".selectpicker[data-id='mySelect']").addClas ...

sending multiple checkbox selections to a PHP script using jQuery

<form id="foo"> <input type="text" name="voucher" placeholder="voucher ID" class="bill_fillter"/> <input type="text" name="voucher" placeholder="voucher ID" class="bill_fillter"/> <input type="text" name="voucher" placeholder="voucher ...

The alignment of the Nivo Slider is off-center

Visit to see that the Nivo Slider is not properly centered on the background. I am unsure why this is happening. (Please disregard the 2nd and 3rd pictures as they are not the correct size, but focus on the 1st one). ...

Words are cut off in a random manner on the entry content list for phone users

I struggle with CSS and have a basic understanding to make adjustments to my website. The issue I am encountering involves the .entry-content ul li elements. On desktop, they display correctly without random word breaks, but on mobile, words are being cut ...

Error: Unescaped string detected in jQuery code

I'm struggling to come up with a name for it, but I'll do my best to explain. $(document).on('click','.swaction',function(event){ var pdfId = $(this).closest('tr').find('td:first').html(); // For examp ...

How can I restrict the navigation buttons in FullCalendar to only allow viewing the current month and the next one?

I recently downloaded the FullCalendar plugin from Is there a way to disable the previous button so that only the current month is visible? Also, how can I limit the next button so that only one upcoming month is shown? In my header, I included this code ...

Get rid of the strange border on the material dialog

I am struggling with the Angular material 6 dialog component as it is displaying a strange border. I have attempted to remove it using the code below, without success. Interestingly, when I apply the style inline in the browser, it works fine. Any suggesti ...