logo
down
shadow

Responsive random circle grid


Responsive random circle grid

By : Mohammad Aslam
Date : November 20 2020, 11:01 PM
help you fix your problem I want to create the following random circle grid in HTML/CSS/JavaScript (excl. effects). I am not sure how to do this. Should I use absolution positioning in order to get this working/responsive? Looks likes a center point is pulling the circles... , You need to use for that kind of gravity effect.
code :


Share : facebook icon twitter icon
Responsive Div Circle inside another responsive div circle and centralized?

Responsive Div Circle inside another responsive div circle and centralized?


By : user3610333
Date : March 29 2020, 07:55 AM
will be helpful for those in need If I understand correctly, you want a 3% border on the element. You can use relative-absolute positioning for this:
code :
.groupIconOuter {
  background: red;
  width: 100%;
  height: 0;
  padding-bottom: 100%;
  -webkit-border-radius: 50%;
     -moz-border-radius: 50%;
          border-radius: 50%;
  position: relative;
}
.groupIconInner {
  background: blue;
  -webkit-border-radius: 50%;
     -moz-border-radius: 50%;
          border-radius: 50%;
  position: absolute;
  left: 3%;
  top: 3%;
  right: 3%;
  bottom: 3%;
}
<div class="groupIconOuter">
  <div class="groupIconInner"></div>
</div>
How to paint a circle with a random size on a random coordinate such that the circle is fully visible?

How to paint a circle with a random size on a random coordinate such that the circle is fully visible?


By : Igor
Date : March 29 2020, 07:55 AM
this one helps. You're trying to use the frame size when calculating the position of the circle, when the frame includes a variable high title bar AND frame insets You're trying to use the frame size when it's irrelevant, it's the component's size you should be using, as it's within the mainPanel's coordinate context which you want to paint
So, how do I fix the issues?
code :
int randomSize = MIN_SIZE + (rand.nextInt(MAX_SIZE) + 1);

int randomPositionX = rand.nextInt(getWidth() - randomSize);
int randomPositionY = rand.nextInt(getHeight() - randomSize);
import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.Timer;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class Test {

    public static void main(String[] args) {
        new Test();
    }

    public Test() {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                try {
                    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
                    ex.printStackTrace();
                }

                JFrame frame = new JFrame("Testing");
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.add(new TestPane());
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setVisible(true);
            }
        });
    }

    public static class TestPane extends JPanel {

        public final static int MAX_SIZE = 100;
        public final static int MIN_SIZE = 10;
        private Rectangle bounds;
        private Random rand;

        public TestPane() {
            rand = new Random();
            Timer timer = new Timer(1000, new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {

                    int randomSize = MIN_SIZE + (rand.nextInt(MAX_SIZE) + 1);

                    int randomPositionX = rand.nextInt(getWidth() - randomSize);
                    int randomPositionY = rand.nextInt(getHeight() - randomSize);

                    bounds = new Rectangle(randomPositionX, randomPositionY, randomSize, randomSize);
                    repaint();
                }
            });
            timer.start();
        }

        @Override
        public Dimension getPreferredSize() {
            return new Dimension(200, 200);
        }

        @Override
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2d = (Graphics2D) g.create();
            if (bounds != null) {
                g2d.setColor(Color.RED);
                g2d.fillOval(bounds.x, bounds.y, bounds.width, bounds.height);
            }
            g2d.dispose();
        }

    }

}
How to make text in responsive circle <div> responsive as well

How to make text in responsive circle <div> responsive as well


By : Serkan İ
Date : March 29 2020, 07:55 AM
hope this fix your issue , Use another method to center the text. Here is an idea with flex:
code :
.circleBase {
  border-radius: 50%;
}

.contact-circle {
  position: fixed;
  width: 23%;
  height: auto;
  padding-top: 23%;
  background-color: rgba(255, 86, 86, 0.2);
}

#contact-text {
  top: 0;
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  text-align: center
}
<div class="circleBase contact-circle">
  <div id="contact-text">
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit,
    </p>
  </div>
</div>
Generating a small circle inside a big circle and produce different random numbers in their radius

Generating a small circle inside a big circle and produce different random numbers in their radius


By : Martín de los Santos
Date : March 29 2020, 07:55 AM
will be helpful for those in need Check the following code segment. You may have to update as per your requirement. As an example think of how to avoid crossing circles.
grid with random image sizes and responsive

grid with random image sizes and responsive


By : chembai ashwin
Date : March 29 2020, 07:55 AM
help you fix your problem Do not use table for this. If you want to reach the layout you attached as an image for example. I do not know how you collect the images, but of course you need them. This library can help you out with the grid thingie. I used that, so I know. It should help you out. It has examples too, how to implement it for your site. Masonry - Cascading Grid Layout library
Because of the comment...
Related Posts Related Posts :
  • Print another HTML page using javascript:window.print
  • Method being called before Promise is complete
  • Integrating a loader with d3.js
  • Uncaught SyntaxError: Unexpected token in Ionic
  • Executing a JavaScript file in HTML code
  • creating your own div
  • Need JS help- collapsing a toggled down element when another is selected
  • Fix the headers in html table populated by ajax
  • How to pass the value of text box and compare it to the variable.. Javascript
  • forEach works on querySelectorAll, but not getElementsByTagName?
  • why does google maps code wrapped in a div not work?
  • How to assign variable for jquery ajax post method
  • Why can't I break out of this for loop?
  • Can't add data to table with plain JS
  • How to read array object in angularjs
  • How to apply class dynamically while doing custom pagination?
  • How to get new line in node JS and passing it as JSON and saving it in a text File
  • ionic.bundle.js:25642 Error: [ngRepeat:iexp] Expected expression in form of '_item_ in _collection_[ track by _id_]' but
  • Dynamically call function in javascript
  • unknown database while running servlet code
  • JQuery hashchange event - where to place?
  • reactjs image slider navigation function, cant seem to get it working properly
  • Javascript normal Array value and Array value created by match function comparison
  • pass a value from javascript to html and codeigniter
  • how to perform div hover shows another div but both div's are different form?
  • Draw a buffer with subbuffers webgl
  • Call a function on click event in Angular 2
  • Object.assign getters and setters in constructor
  • Have to set Number of Threads, Ramp up Period and Loop count from an external properties file
  • Post data from javascript to php file using ajax doesn't work
  • How to access method in prototypal inheritance pattern?
  • Q: How do I make each div fade away individually?
  • JavaScript/jQuery: how to get HTML and display HTML, including tags
  • Controller not loading if javaScript containing controller code is added dynamically to HTML dom
  • TypeError while retriving prototype properties
  • Google Maps API: adding zip code boundaries
  • Validating date with current date using jquery
  • ComponentWillMount keeps being called repeately
  • Laravel URL Generator With Angular JS Varible
  • Post data to another php page using ajax
  • Progressbar behavior depending on checkboxes bootstrap + jquery
  • node.js/socket.io/express execution order
  • nested EJS tag. Not working
  • Service call in controller in AngularJs using ES6
  • Div that acts as file upload?
  • Load D3 Url With API key
  • Read data in JSON format asp.net View in MVC
  • How to make separate force layout render loop?
  • Download a JSON behind a login page with nightmare
  • Regex to scan for a specific number of a repeating character
  • Array push still using previous reference?
  • Javascript context.closePath() method does not appear
  • Javascript variable undefined even after defining in Express Js, mongo db
  • How to add hover effect to <table> using CKEditor?
  • Autocomplete List Fixed Position Browser Resize
  • RegEx trying to match anything but a certain pattern with chars from the pattern being allowed
  • Validating value in HTML number input with Konva
  • Is any class object serializable in javascript?
  • 'content-type': 'text/html' not accepted until server is killed
  • Vue js Ready function is not triggered
  • shadow
    Privacy Policy - Terms - Contact Us © soohba.com